try:
  import xbmc, xbmcgui;
except:
  # For command line testing outside of XBMC
  from FakeXBMC import FakeXBMC;
  xbmc = FakeXBMC();
  from FakeXBMCGUI import FakeXBMCGUI;
  xbmcgui = FakeXBMCGUI();

def Main(oSettings):
  from checkSettings import checkSettings;
  if not checkSettings(oSettings):
    return;

  from readDisc import readDisc;
  oDisc = readDisc(oSettings);
  if not oDisc:
    return;

  from askInformationAndSelectTitles import askInformationAndSelectTitles;
  if not askInformationAndSelectTitles(oSettings, oDisc):
    return;

  from ripDisc import ripDisc;
  if not ripDisc(oSettings, oDisc):
    return;

#  oDialog = xbmcgui.Dialog();
#  oDialog.ok(oSettings.sName, "Ripping completed.");

if __name__ == "__main__":
  import sys;
  from FakeSettings import FakeSettings;
  
  oFakeSettings = FakeSettings({
      "makemkvcon-path": sys.argv[1],
      "destination-path": sys.argv[2],
      "minimal-duration": int(sys.argv[3]),
  });
  Main(oFakeSettings);
